package org.agentsherpa;


import org.agentsherpa.model.Direction;
import org.agentsherpa.model.Point;

import junit.framework.TestCase;

public class Test1 extends TestCase {
	
    private Direction defaultDirection(Point currentLocation, Point targetLocation) {
    	Direction ret = Direction.West;
    	double distance = currentLocation.distance(targetLocation);
		for (Direction dir : Direction.values()) {
			Point p = dir.move(currentLocation);
			double d = p.distance(targetLocation);
			if (d < distance) {
				distance = d;
				ret = dir;
			}
		}
    	return ret;
	}


    public void testDefaultDirection() {
    	Point zero = new Point(0, 0);
    	assertEquals(Direction.West, defaultDirection(new Point(3, 0), zero));
    	assertEquals(Direction.East, defaultDirection(new Point(-3, 0), zero));
    	assertEquals(Direction.South, defaultDirection(new Point(0, 3), zero));
    	assertEquals(Direction.North, defaultDirection(new Point(0, -3), zero));
    }
    
}
